package com.atguigu.srb.base.exception;

import com.atguigu.srb.base.response.ResponseEnum;
import lombok.Getter;

/**
 * 自定义异常类
 */
@Getter
public class BusinessException extends RuntimeException{
    //用来接收将来发生异常时 希望返回的失败的R对象的code和msg
    private Integer code;
    private String msg;

    public BusinessException(Integer code,String msg){
        super(msg);
        this.code = code;
        this.msg = msg;
    }
    public BusinessException(ResponseEnum responseEnum){
        super(responseEnum.getMsg());
        this.code = responseEnum.getCode();
        this.msg = responseEnum.getMsg();
    }
}
